<template>
<a-layout id="app">
    <a-layout-sider
      :trigger="null"
      collapsible
      v-model="collapsed">
      <div class="logo" />
      <a-menu
        :defaultSelectedKeys="defaultSelectedKeys"
        mode="inline"
        theme="dark"
        @select="handleSelect">
        <a-menu-item key="/">
          <a-icon type="home" />
          <span>首页</span>
        </a-menu-item>
        <!-- <a-menu-item key="/info">
          <a-icon type="profile" />
          <span>详情</span>
        </a-menu-item> -->
      </a-menu>
    </a-layout-sider>
    <a-layout>
      <a-layout-header style="background: #D7DDE4; padding: 0">
        <a-icon
          class="trigger"
          :type="collapsed ? 'menu-unfold' : 'menu-fold'"
          @click="()=> collapsed = !collapsed"
        />
        <!-- <a-input placeholder="搜索" v-model="key">
          <a-icon slot="prefix" type="search" />
        </a-input> -->
      </a-layout-header>
      <a-layout-content :style="{ padding: '24px', background: '#EFF3F6', minHeight: '280px' }">
        <router-view/>
      </a-layout-content>
    </a-layout>
  </a-layout>
</template>
<script>
export default {
  data () {
    return {
      collapsed: true,
      key: '',
      defaultSelectedKeys: [1]
    }
  },
  methods: {
    handleSelect ({ item, key }) {
      this.$router.push({ path: '/' })
    }
  }
}
</script>
<style>
#app {
  min-height: 100%;
}
#app .trigger {
  font-size: 18px;
  line-height: 64px;
  padding: 0 24px;
  cursor: pointer;
  transition: color .3s;
}

#app .trigger:hover {
  color: #1890ff;
}

#app .logo {
  height: 32px;
  background: rgba(255,255,255,.2);
  margin: 16px;
}
</style>
